package com.observer.custom;

import com.observer.custom.observer_object.CurrentConditionsDisplay;
import com.observer.custom.observer_object.ForecastDisplay;
import com.observer.custom.observer_object.StatisticsDisplay;

/**
 * @ClassName: TestObserver
 * @Author: ZhangYue26
 * @Description: 测试观察者
 * @Date: 2020-09-17
 */
public class TestObserver {
    public static void main(String[] args) {
        WeatherData weatherData = new WeatherData();
        CurrentConditionsDisplay currentConditionsDisplay = new CurrentConditionsDisplay(weatherData);//观察者对象1--构造中添加被观察者weatherData并将观察者添加到被观察者内置的观察者列表中
        StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData);//观察者对象2--构造中添加被观察者weatherData并将观察者添加到被观察者内置的观察者列表中
        ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData);//观察者对象3--构造中添加被观察者weatherData并将观察者添加到被观察者内置的观察者列表中
        weatherData.setMeasurements(25,0.698f,1010000);
    }
}
